//从身份中获取性别
watch(()=>data.baseInfo.idCard,(newValue)=>{
  //新的身份证
  console.log("idCard>>>",newValue)
  // 效验身份证号格式
  const reg = /^[1-9]\d{5}(19|20)\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/;
  if (reg.test(data.baseInfo.idCard)) {
    //获取出生日期
    let birthday = data.baseInfo.idCard.substring(6, 10) + '-' + data.baseInfo.idCard.substring(10, 12) + '-' + data.baseInfo.idCard.substring(12, 14);
    console.log("生日",birthday)
    let year = birthday.substring(0,4)
    let month = birthday.substring(4,6)
    let day = birthday.substring(6,8)
    //计算年龄
    let  now = new Date()
    let currentYear = now.getFullYear()//本年
    let currentMonth = now.getMonth()+1//本月
    let  currentDay = now.getDate()//本日
    let age = currentYear-parseInt(year)-1//年龄
    //如果出生年月日比当前日期小，则年龄+1
    if(parseInt(month)<currentMonth||parseInt(month)==currentMonth&&parent(day)<=currentDay){
      age++
    }
    console.log('年龄',age)
   let sex;
    //获取性别
    if (data.baseInfo.idCard.substr(16, 1) % 2 == 1) {
       sex = "男"
    } else {
      sex = "女"
    }
    console.log(sex)
  }
},{deep:true})